package com.corejsf;

import java.io.Serializable;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;

/**
 * Timesheet is a bean that exists in a row within the Edit Time Sheet.
 *
 * @author Victor
 * @version 1.0
 */

@Named ("timesheet")
@ApplicationScoped
public class Timesheet implements Serializable {

    /**
     * serial Version ID.
     */
    private static final long serialVersionUID = -5903746910457232722L;
    /**
     * project ID.
     */
    private double project;
    /**
     * WP ID.
     */
    private String wp;
    /**
     * readonly Totals per bean.
     */
    private double total;
    /**
     * Sat hours value.
     */
    private double sat;
    /**
     * Sun hours value.
     */
    private double sun;
    /**
     * Mon hours value.
     */
    private double mon;
    /**
     * Tue hours value.
     */
    private double tue;
    /**
     * Wed hours value.
     */
    private double wed;
    /**
     * Thu hours value.
     */
    private double thu;
    /**
     * Fri hours value.
     */
    private double fri;
    /**
     * Notes for each row.
     */
    private String notes;

    /**
     * No param constructor.
     */
    public Timesheet() {
    }

    /**
     * Get project.
     *
     * @return project
     */
    public double getProject() {
        return project;
    }

    /**
     * Set project.
     *
     * @param project numeric to be recorded
     */
    public void setProject(final double project) {
        this.project = project;
    }

    /**
     * Get wp.
     *
     * @return wp
     */
    public String getWp() {
        return wp;
    }

    /**
     * Set wp.
     *
     * @param wp work plan to be recorded
     */
    public void setWp(final String wp) {
        this.wp = wp;
    }

    /**
     * Gets the total for the bean.
     *
     * Call to setTotal() allows 'Save Changes' button to
     * update total on first click.
     *
     * @return total
     */
    public double getTotal() {
        setTotal(total);
        return total;
    }

    /**
     * Sets the total when the page is saved.
     *
     * @param timesheet total to be re-evaluated
     */
    public void setTotal(double total) {
        total = sat + sun + mon + tue + wed + thu + fri;
        this.total = total;
    }

    /**
     * Get Sat cell.
     *
     * @return sat
     */
    public double getSat() {
        return sat;
    }

    /**
     * Set Sat cell.
     *
     * @param sat Saturday hour total
     */
    public void setSat(final double sat) {
        this.sat = sat;
    }

    /**
     * Get Sun cell.
     *
     * @return sun
     */
    public double getSun() {
        return sun;
    }

    /**
     * Set Sun cell.
     *
     * @param sun Sunday hour total
     */
    public void setSun(final double sun) {
        this.sun = sun;
    }

    /**
     * Get Mon cell.
     *
     * @return mon
     */
    public double getMon() {
        return mon;
    }

    /**
     * Set Mon cell.
     *
     * @param mon Monday hour total
     */
    public void setMon(final double mon) {
        this.mon = mon;
    }

    /**
     * Get Tue cell.
     *
     * @return tue
     */
    public double getTue() {
        return tue;
    }

    /**
     * Set Tue cell.
     *
     * @param tue Tuesday hour total
     */
    public void setTue(final double tue) {
        this.tue = tue;
    }

    /**
     * Get Wed cell.
     *
     * @return wed
     */
    public double getWed() {
        return wed;
    }

    /**
     * set Wed cell.
     *
     * @param wed Wednesday hour total
     */
    public void setWed(final double wed) {
        this.wed = wed;
    }

    /**
     * get Thu cell.
     *
     * @return thu
     */
    public double getThu() {
        return thu;
    }
 
    /**
     * set Thu Cell.
     *
     * @param thu Thursday hour total
     */
    public void setThu(final double thu) {
        this.thu = thu;
    }

    /**
     * Get Fri cell.
     *
     * @return fri Friday
     */
    public double getFri() {
        return fri;
    }

    /**
     * Set Fri cell.
     *
     * @param fri Friday hour total
     */
    public void setFri(final double fri) {
        this.fri = fri;
    }

    /**
     * Get string of notes.
     *
     * @return notes
     */
    public String getNotes() {
        return notes;
    }

    /**
     * Set notes.
     *
     * @param notes Notes or comments to be recorded on timesheet
     */
    public void setNotes(final String notes) {
        this.notes = notes;
    }

}
